// app.js
App({
  onLaunch(options) {
    // console.log('App onLaunch 场景值', options.scene)

    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
  },

  onShow(options) {
    console.log('App onShow', options)
  },

  onHide() {
    console.log('App onHide')
  },
  
  onError(error) {
    console.log('App onError', error)
  },

  onUnhandledRejection(error) {
    // error.resaon 错误原因
    // error.promise 对应的promise
    console.log('App onUnhandledRejection', error)
  },

  onPageNotFound() {
    console.log('App onPageNotFound')
  },

  onThemeChange() {
    console.log('onThemeChange')
  },

  globalData: {
    userInfo: null
  }
})
